﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:wp7cinema_ViewModel="clr-namespace:wp7cinema.ViewModel" xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls" 
    x:Class="wp7cinema.View.TheaterSearch2"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Forward><!-- 나올때 -->
            	<toolkit:SlideTransition Mode="SlideLeftFadeIn" />
            </toolkit:NavigationInTransition.Forward>
            <toolkit:NavigationInTransition.Backward><!--back버튼으로 돌아왔을때-->
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Forward><!-- 페이지 이동 -->
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
            <toolkit:NavigationOutTransition.Backward><!-- back버튼으로나갈때 -->
                <toolkit:SlideTransition Mode="SlideRightFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
	<phone:PhoneApplicationPage.Resources>
		<DataTemplate x:Key="DataTemplate1">
			<Grid>
				<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Title}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<DataTemplate x:Key="ListPickerFullModeTemplate">
			<StackPanel Orientation="Horizontal" Margin="16,21,0,20">
				<Rectangle Fill="#FFA8E4F3" Stroke="Black" Height="43" Width="43"/>
				<TextBlock TextWrapping="Wrap" Text="{Binding Title}" FontSize="43" Margin="16,0,0,0"/>
			</StackPanel>
		</DataTemplate>
		<DataTemplate x:Key="TheaterListTemplate">
			<Grid>
				<TextBlock TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<DataTemplate x:Key="DateListTemplate">
			<Grid>
				<TextBlock TextWrapping="Wrap" Text="{Binding Value}" d:LayoutOverrides="Height"/>
			</Grid>
		</DataTemplate>
		<Style x:Key="TheaterItemStyle" TargetType="ListBoxItem">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Grid>
							<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Name}" d:LayoutOverrides="Height" Margin="10,0,0,10"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</phone:PhoneApplicationPage.Resources>
 
<!--Sample code showing usage of ApplicationBar--><!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>

	<phone:PhoneApplicationPage.DataContext>
		<wp7cinema_ViewModel:TheaterSearch2ViewModel/>
	</phone:PhoneApplicationPage.DataContext>
<!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
        	<RowDefinition Height="Auto"/>
        	<RowDefinition Height="*"/>
        </Grid.RowDefinitions>

    	<Custom:Interaction.Triggers>
    		<Custom:EventTrigger EventName="SelectionChanged" SourceName="listPicker1">
    			<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetRegionCmd" Command="{Binding SetRegionCommand}" CommandParameter="{Binding ElementName=listPicker1, Mode=OneWay}"/>
    		</Custom:EventTrigger>
    		<Custom:EventTrigger EventName="SelectionChanged" SourceName="listPicker2">
    			<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetSubRegionCmd" Command="{Binding SetSubRegionCommand}" CommandParameter="{Binding ElementName=listPicker2, Mode=OneWay}"/>
    		</Custom:EventTrigger>
    		<Custom:EventTrigger EventName="Click" SourceName="SearchBtn">
    			<GalaSoft_MvvmLight_Command:EventToCommand x:Name="TheaterSearchCmd" Command="{Binding SearchTheaterCommand}" CommandParameter="{Binding Text, ElementName=SearchBox}"/>
    		</Custom:EventTrigger>
    		<Custom:EventTrigger EventName="SelectionChanged" SourceName="TheaterList">
    			<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetTheater" Command="{Binding SetTheaterCommand}" CommandParameter="{Binding SelectedItem, ElementName=TheaterList}"/>
    		</Custom:EventTrigger>
    		<Custom:EventTrigger EventName="SelectionChanged" SourceName="TheaterList2">
    			<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SetTheater2" Command="{Binding SetTheaterCommand}" CommandParameter="{Binding SelectedItem, ElementName=TheaterList2}"/>
    		</Custom:EventTrigger>
    	</Custom:Interaction.Triggers>
    	<controls:Pivot Grid.Row="1" Title="극장검색">
    		<controls:PivotItem Header="지역별검색" Height="607">
    			<StackPanel Orientation="Vertical" d:LayoutOverrides="Height">
    				<StackPanel Orientation="Horizontal">
    					<toolkit:ListPicker x:Name="listPicker1" Margin="0,0,5,0" ItemsSource="{Binding Region1}" ItemTemplate="{StaticResource DataTemplate1}" Width="233" d:LayoutOverrides="Height" Header="지역1" ItemCountThreshold="10" FontSize="32"/>
    					<toolkit:ListPicker x:Name="listPicker2" Margin="0" ItemsSource="{Binding Region2}" ItemTemplate="{StaticResource DataTemplate1}" Width="233" d:LayoutOverrides="Height" Header="지역2" FullModeItemTemplate="{StaticResource ListPickerFullModeTemplate}" FullModeHeader="지역을선택해주세요" ItemCountThreshold="10" FontSize="32"/>
    				</StackPanel>
    				<StackPanel Margin="0,20,0,0" Orientation="Vertical" Background="#FF476078">
    					<TextBlock TextWrapping="Wrap" Text="극 장" FontSize="26.667" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    				</StackPanel>
    				<ListBox x:Name="TheaterList" Margin="0,10,0,0" IsSynchronizedWithCurrentItem="False" ItemsSource="{Binding Theaters}" FontSize="32" ItemContainerStyle="{StaticResource TheaterItemStyle}" Height="445"/>
    			</StackPanel>
    		</controls:PivotItem>
    		<controls:PivotItem Header="이름검색">
    			<StackPanel>
    				<StackPanel Orientation="Horizontal">
    					<TextBox x:Name="SearchBox" TextWrapping="Wrap" Width="365"/>
    					<Button x:Name="SearchBtn" Content="검색"/>
    				</StackPanel>
    				<StackPanel Orientation="Vertical" Background="#FF476078" Margin="12,5,0,0">
    					<TextBlock TextWrapping="Wrap" Text="극 장" FontSize="26.667" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    				</StackPanel>
    				<ListBox x:Name="TheaterList2" Margin="0,10,0,0" IsSynchronizedWithCurrentItem="False" FontSize="32" ItemContainerStyle="{StaticResource TheaterItemStyle}" Height="483" ItemsSource="{Binding Theaters2}"/>
    			</StackPanel>
    		</controls:PivotItem>
    	</controls:Pivot>
    </Grid>

</phone:PhoneApplicationPage>
